﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Help;
using Bll;
using System.Data;

namespace Myproject.BSM.Ashx.PcBase
{
    /// <summary>
    /// NavigationDelete 的摘要说明
    /// </summary>
    public class NavigationDelete : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string id = context.Request.QueryString["id"];
            DataSet DS = new NavBLL().GetList(" ParentID=" + id);
            if (DS.Tables[0].Rows.Count > 0)
            {
                context.Response.Write(ReturnJsonHelp.OutHandlerJson(false, "删除导航失败,有子导航！"));

            }
            else
            {
                if (new NavBLL().Delete(int.Parse(id)))
                {
                    context.Response.Write(ReturnJsonHelp.OutHandlerJson(true, "删除导航成功！"));
                }
                else
                {
                    context.Response.Write(ReturnJsonHelp.OutHandlerJson(false, "删除导航失败！"));
                }
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}